package com.moss.cloud.plugins.biz.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.moss.cloud.plugins.api.model.from.BaseFrom;
import com.moss.cloud.plugins.api.model.from.GenerationCodeFrom;
import com.moss.cloud.plugins.api.model.from.ModelDesignFrom;
import com.moss.cloud.plugins.api.model.from.ProjectCodeFrom;
import com.moss.cloud.plugins.api.model.param.ModelDesignParam;
import com.moss.cloud.plugins.api.model.vo.ModelDesignVO;
import com.moss.cloud.plugins.biz.model.ModelDesign;
import freemarker.template.TemplateException;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 模型设计业务接口
 *
 * @author 瑾年
 * @date 2024年1月4日
 */
public interface IModelDesignService extends IService<ModelDesign> {

    /**
     * 模型分页查询
     *
     * @param param
     * @return
     */
    IPage<ModelDesign> page(ModelDesignParam param);

    /**
     * 新增模型设计
     *
     * @param modelDesignFrom
     * @return
     */
    boolean saveModelDesign(ModelDesignFrom modelDesignFrom);

    /**
     * 更新模型设计
     *
     * @param modelDesignFrom
     * @return
     */
    boolean updateModelDesign(ModelDesignFrom modelDesignFrom);

    /**
     * 删除模型
     *
     * @param baseFrom
     * @return
     */
    boolean removeModelDesign(BaseFrom baseFrom);

    /**
     * 模型详情
     *
     * @param baseFrom
     * @return
     */
    ModelDesignVO modeDetail(BaseFrom baseFrom);

    /**
     * 获取SQL脚本
     *
     * @param baseFrom
     * @return
     */
    String getSqlScript(BaseFrom baseFrom);

    /**
     * 同步数据源
     *
     * @param baseFrom
     * @return
     */
    boolean syncDataSource(BaseFrom baseFrom);

    /**
     * 撤回同步
     *
     * @param baseFrom
     * @return
     */
    boolean recallSync(BaseFrom baseFrom);

    /**
     * 生成代码
     *
     * @param generationCodeFrom
     * @param response
     * @return
     */
    void generateCode(HttpServletResponse response, GenerationCodeFrom generationCodeFrom);

    /**
     * 标准项目模板生成
     *
     * @param response
     * @param projectCodeFrom
     */
    void genProject(HttpServletResponse response, ProjectCodeFrom projectCodeFrom);
}
